Skip to content

feat: add MegaETH mainnet and testnet support - #41

Open
Haaaarry wants to merge 1 commit into
mcpdotdirect:mainfrom
Haaaarry:feat/megaeth
Open

feat: add MegaETH mainnet and testnet support#41
Haaaarry wants to merge 1 commit into
mcpdotdirect:mainfrom
Haaaarry:feat/megaeth

Conversation

@Haaaarry

Copy link
Copy Markdown

Summary

Adds support for the MegaETH chain (resolves #23).

Two networks are added because viem 2.39.3 (the version pinned by this repo) exports neither of them:

  • MegaETH mainnet — chain id 4326
  • MegaETH Testnet — chain id 6343

Note: viem's built-in megaethTestnet points at chain id 6342, which the chain registry (chainid.network / ethereum-lists/chains) now marks as deprecated. So both networks are defined locally with defineChain using the current registry values.

Changes

  • src/core/chains.ts
    • define megaeth and megaethTestnet via defineChain
    • register both in chainMap, networkNameMap, and rpcUrlMap
  • README.md
    • add MegaETH to the mainnet list and MegaETH Testnet to the testnet list

Verification

  • bunx tsc --noEmit passes
  • bun run build passes
  • Confirmed both RPC endpoints respond with the expected chain ids:
    • https://mainnet.megaeth.com/rpc -> 0x10e6 (4326)
    • https://carrot.megaeth.com/rpc -> 0x18c7 (6343)

Add MegaETH mainnet (4326) and testnet (6343) via defineChain, since viem 2.39.3 does not export them. RPC endpoints verified against chainid.network.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add MegaETH support

1 participant